﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using br.com.SistemaChamados.Controller.Common;
using br.com.SistemaChamados.Constants;
using br.com.SistemaChamados.Util;

namespace SysCall_FINAL.Pages.Contact
{
    public partial class Contact : System.Web.UI.Page
    {
        protected void Page_PreInit(object sender, EventArgs e)
        {
            br.com.SistemaChamados.Model.Common.User loggedUser = new br.com.SistemaChamados.Model.Common.User();
            UserController userController = new UserController();
            if (Session[UserConstants.SESSION_USER_LOGGED_IN] != null)
            {
                loggedUser.Id = Convert.ToInt32(Session[UserConstants.SESSION_USER_LOGGED_IN]);
                loggedUser = userController.GetUser(loggedUser);
                this.MasterPageFile = MasterPageDefiner.defineMasterPageByAccessRole(loggedUser.Profile);
                ((Label)Master.FindControl("lblUser")).Text = loggedUser.Name;
                this.Title = "SysCall - Sistema de chamados [logado como " + loggedUser.Name + "]";
            }
            else
            {
                Response.Redirect("~/Pages/Login/Login.aspx");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}